{
  "name": "Case 3 – Insurance Claim Fraud Triage",
  "nodes": [
    {
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2,
      "position": [0, 0],
      "parameters": {
        "formTitle": "Motor Insurance Claim Submission",
        "formDescription": "Submit claim documents for assessment",
        "formFields": {
          "values": [
            { "fieldLabel": "Policyholder Name", "requiredField": true },
            { "fieldLabel": "Email id", "fieldType": "email", "requiredField": true },
            {
              "fieldLabel": "Claim_Dossier",
              "fieldType": "file",
              "acceptFileTypes": ".pdf",
              "requiredField": true
            }
          ]
        }
      }
    },
    {
      "name": "Upload file",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [220, 0],
      "parameters": {
        "inputDataFieldName": "Claim_Dossier",
        "name": "={{ $json['Policyholder Name'] + '_Claim_Dossier' }}",
        "folderId": "REPLACE_WITH_INSURANCE_FOLDER_ID"
      }
    },
    {
      "name": "Download file",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [420, 0],
      "parameters": {
        "operation": "download",
        "fileId": "={{ $json.id }}"
      }
    },
    {
      "name": "Extract Claim Dossier",
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [620, 0],
      "parameters": { "operation": "pdf" }
    },
    {
      "name": "Download Claims Policy",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [820, 0],
      "parameters": {
        "operation": "download",
        "fileId": "REPLACE_WITH_CLAIMS_POLICY_FILE_ID"
      }
    },
    {
      "name": "Extract Claims Policy",
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [1020, 0],
      "parameters": { "operation": "pdf" }
    },
    {
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3,
      "position": [220, 260],
      "parameters": {
        "promptType": "define",
        "text": "=Claim Dossier:\n{{ $('Extract Claim Dossier').item.json.text }}\n\nClaims Policy:\n{{ $('Extract Claims Policy').item.json.text }}",
        "options": {
          "systemMessage": "You are a Senior Insurance Claims Analyst. Perform claim triage strictly as per internal policy. Output ONLY valid JSON and call the Google Sheets Append Row tool."
        }
      }
    },
    {
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [0, 420],
      "parameters": {
        "model": { "mode": "list", "value": "gpt-4.1-mini" }
      }
    },
    {
      "name": "Append row",
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4,
      "position": [420, 460],
      "parameters": {
        "operation": "append",
        "documentId": "REPLACE_WITH_GOOGLE_SHEET_ID",
        "sheetName": "Motor Insurance – Claims Triage Register"
      }
    },
    {
      "name": "Send Email",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2,
      "position": [420, 260],
      "parameters": {
        "sendTo": "={{ $('On form submission').item.json['Email id'] }}",
        "subject": "Motor Insurance Claim – Initial Review",
        "message": "={{ 'Dear ' + $('On form submission').item.json['Policyholder Name'] + ',<br><br>Your insurance claim has been reviewed under our internal triage process. We will contact you if additional verification is required.<br><br>Regards,<br>Claims Team' }}"
      }
    }
  ],
  "connections": {
    "On form submission": { "main": [[{ "node": "Upload file" }]] },
    "Upload file": { "main": [[{ "node": "Download file" }]] },
    "Download file": { "main": [[{ "node": "Extract Claim Dossier" }]] },
    "Extract Claim Dossier": { "main": [[{ "node": "Download Claims Policy" }]] },
    "Download Claims Policy": { "main": [[{ "node": "Extract Claims Policy" }]] },
    "Extract Claims Policy": { "main": [[{ "node": "AI Agent" }]] },
    "OpenAI Chat Model": { "ai_languageModel": [[{ "node": "AI Agent" }]] },
    "Append row": { "ai_tool": [[{ "node": "AI Agent" }]] },
    "AI Agent": { "main": [[{ "node": "Send Email" }]] }
  },
  "active": false
}
